package com.lightman.gulimall.product.feign;

import com.lightman.common.to.SkuReductionTo;
import com.lightman.common.to.SpuBoundTo;
import com.lightman.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient("gulimall-coupon")
public interface CouponFeignService {

    /**
     * CouponFeignService.saveSpuBounds(SpuBoundTo);
     *  1、 @@RequestBody 将这个对象转为json
     *  2、 找到gulimall-coupon服务, 给 /coupon/spubounds/save 发送请求.
     *      将上一步转的json 放在请求位置,
     *  3、 对方服受到到请求, 请求体里有json 数据
     *      (@RequestBody SpuBoundsEntity spuBounds ); 将请求体的json 转为SpuBoundsEntity
     *
     * 只要json数据 是兼容的,双方服务无需使用同一个to
     * @param spuBoundTo
     * @ret urn
     */
    @PostMapping("/coupon/spubounds/save")
    R saveSpuBounds(@RequestBody SpuBoundTo spuBoundTo);

    @PostMapping("/coupon/skufullreduction/saveinfo")
    R saveSkuReduction(@RequestBody SkuReductionTo skuReductionTo);
}
